import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/labeltemplate/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-admin/labeltemplate/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-admin/labeltemplate/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-admin/labeltemplate/submit',
    method: 'post',
    data: row
  });
};
export const addinfo = (row) => {
  return request({
    url: '/api/mes-admin/labeltemplate/submitVersion',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-admin/labeltemplate/submit',
    method: 'post',
    data: row
  });
};
//标签模板绑定数据源
export const bindingDataSql = (labelTemplateIds, selectionid) => {
  return request({
    url: '/api/mes-admin/labeltemplate/bindingDataSql?labelTemplateIds=' + labelTemplateIds + '&sqlId=' + selectionid,
    method: 'post'
  });
};
//标签模板解绑数据源
export const unBindingDataSql = (labelTemplateIds) => {
  return request({
    url: '/api/mes-admin/labeltemplate/unBindingDataSql',
    method: 'post',
    params: {
      labelTemplateIds
    }
  });
};

// 配置默认SCM模板
export const setDefaultScm = (id) => {
  return request({
    url: '/api/mes-admin/labeltemplate/scm-default',
    method: 'get',
    params: {
      id
    }
  });
};
// 获取系统默认scm规则和模版
export const getScmDefault = () => {
  return request({
    url: '/api/mes-admin/vendor/get-scm-default',
    method: 'get'
  });
};
